package com.backend.werewolfkillingbackend.common;

import lombok.Data;

@Data
public class R<T> {

    private T data;

    private String msg;

    private Integer code;

    public static <T> R<T> success(T object, String msg) {
        R<T> r = new R<>();
        r.data = object;
        r.msg = msg;
        r.code = 200;
        return r;
    }

    public static <T> R<T> error(T object) {
        R<T> r = new R<>();
        r.data = object;
        r.code = 400;
        r.msg = "error";
        return r;
    }

}
